******************************************************************************************
***                             *** REPLICATION DO FILE ***                            ***
******************************************************************************************

******************************************************************************************
*** "The responsive public: How EU decisions shape public opinion on salient policies" *** 
*** Author: Christoph Mikulaschek                                                      *** 
*** Forthcoming in: European Union Politics                                            *** 
*** Date: 6/15/2023                                                                    ***
******************************************************************************************

*** Note: code to replicate results in figures and results tables is presented in the order in which figures and results tables appear in main text and appendix 
*** Load correct dataset before replicating analyses: 
***   - recoveryaid.csv: for analyses of Coronavirus economic recovery aid experiment
***   - refugeerelocation.csv: for analyses of refugee relocation experiment
***   - eurobarometer-subset.csv: for quasi-experimental analyses of Eurobarometer data 

******************************************
*** FIGURES PRESENTED IN THE MAIN TEXT ***
******************************************

*** Figure 1: Predicted probabilities of support of Coronavirus economic recovery aid and refugee resettlement: effect of approval and non-approval of these policies by the Council of the EU 

* Note: code to calculate predicted probabilities appears below; for code to prepare plot please refer to R do file  

* Coronavirus recovery aid experiment
reg aiddvrescaled aidapp female age income1000 i.educ polinterest forinterest left galtan, r
margins, atmeans at(aidapp == 1) // approval
margins, atmeans at(aidapp == 0) // no approval

* Refugee relocation experiment
reg refdvrescaled refapp female age income1000 i.educ polinterest forinterest left galtan, r
margins, atmeans at(refapp == 1) // approval
margins, atmeans at(refapp == 0) // no approval

*** Figure 2: Predicted probabilities of support of Coronavirus economic recovery aid and refugee resettlement by level of trust in Council of the EU

* Note: code to calculate predicted probabilities appears below; for code to prepare plot please refer to R do file  

* Coronavirus recovery aid experiment
regress aiddvrescaled aidapp trusteuaid3 trusteuaid3aidapp female age income1000 i.educ polinterest forinterest left galtan trustdeaid, r
margins, atmeans at(aidapp==1 trusteuaid3==0 trusteuaid3aidapp==0) // EU Council approval of policy, complete or large trust in EU
margins, atmeans at(aidapp==1 trusteuaid3==1 trusteuaid3aidapp==1) // EU Council approval of policy, moderate trust in EU
margins, atmeans at(aidapp==1 trusteuaid3==2 trusteuaid3aidapp==2) // EU Council approval of policy, little or no trust in EU
margins, atmeans at(aidapp==0 trusteuaid3==0 trusteuaid3aidapp==0) // no EU Council approval of policy, complete or large trust in EU
margins, atmeans at(aidapp==0 trusteuaid3==1 trusteuaid3aidapp==0) // no EU Council approval of policy, moderate trust in EU
margins, atmeans at(aidapp==0 trusteuaid3==2 trusteuaid3aidapp==0) // no EU Council approval of policy, little or no trust in EU

* Refugee relocation experiment
regress refdvrescaled refapp trusteuref3 trusteuref3refapp female age income1000 i.educ polinterest forinterest left galtan trustderef, r  
margins, atmeans at(refapp==1 trusteuref3==0 trusteuref3refapp==0) // EU Council approval of policy, complete or large trust in EU
margins, atmeans at(refapp==1 trusteuref3==1 trusteuref3refapp==1) // EU Council approval of policy, moderate trust in EU
margins, atmeans at(refapp==1 trusteuref3==2 trusteuref3refapp==2) // EU Council approval of policy, little or no trust in EU
margins, atmeans at(refapp==0 trusteuref3==0 trusteuref3refapp==0) // no EU Council approval of policy, complete or large trust in EU
margins, atmeans at(refapp==0 trusteuref3==1 trusteuref3refapp==0) // no EU Council approval of policy, moderate trust in EU
margins, atmeans at(refapp==0 trusteuref3==2 trusteuref3refapp==0) // no EU Council approval of policy, little or no trust in EU

*** Figure 3: Predicted probabilities of support of Coronavirus economic recovery aid and refugee resettlement: effect of unity and divisions in the Council of the EU

* Note: code to calculate predicted probabilities appears below; for code to prepare plot please refer to R do file  

* Coronavirus recovery aid experiment
reg aiddvrescaled i.aideu female age income1000 i.educ polinterest forinterest left galtan, r
margins, atmeans at(aideu == 1) // unanimity
margins, atmeans at(aideu == 2) // dissent
margins, atmeans at(aideu == 3) // vetoes
margins, atmeans at(aideu == 4) // broad opposition

* Refugee relocation experiment
reg refdvrescaled i.refeu female age income1000 i.educ polinterest forinterest left galtan, r
margins, atmeans at(refeu == 1) // unanimity
margins, atmeans at(refeu == 2) // dissent
margins, atmeans at(refeu == 3) // vetoes
margins, atmeans at(refeu == 4) // broad opposition

*** Figure 4: Predicted probabilities of support of Coronavirus economic recovery aid before and after European Council decision by level of trust in EU's judgment

* Note: code to calculate predicted probabilities appears below; for code to prepare plot please refer to R do file  

* quasi-experimental analyses of Eurobarometer data 
reg financialsupport aftereusummit trusteucorona aftersummittrusteucorona female age i.incomecat i.educ polinterest eurinterest left leftsq, r 
	
margins, at(aftereusummit=0 trusteucorona=0 aftersummittrusteucorona=0) atmeans // before European Council summit, total trust in EU
margins, at(aftereusummit=0 trusteucorona=1 aftersummittrusteucorona=0) atmeans // before European Council summit, tendency to trust EU
margins, at(aftereusummit=0 trusteucorona=2 aftersummittrusteucorona=0) atmeans // before European Council summit, tendency not to trust EU
margins, at(aftereusummit=0 trusteucorona=3 aftersummittrusteucorona=0) atmeans // before European Council summit, no trust in EU at all
margins, at(aftereusummit=1 trusteucorona=0 aftersummittrusteucorona=0) atmeans // after European Council summit, total trust in EU
margins, at(aftereusummit=1 trusteucorona=1 aftersummittrusteucorona=1) atmeans // after European Council summit, tendency to trust EU
margins, at(aftereusummit=1 trusteucorona=2 aftersummittrusteucorona=2) atmeans // after European Council summit, tendency not to trust EU
margins, at(aftereusummit=1 trusteucorona=3 aftersummittrusteucorona=3) atmeans // after European Council summit, no trust in EU at all


**********************************************************
*** TABLES AND FIGURES REPORTED IN THE ONLINE APPENDIX ***
**********************************************************

*** Analysis of original surveys containing experiments
*******************************************************

*** Tests of hypothesis 1: Main models

* Model 1: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp, r  

* Model 2: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp female age income1000 i.educ polinterest forinterest left galtan, r

* Model 3: refugee relocation experiment
reg refdvrescaled refapp, r  

* Model 4: refugee relocation experiment
reg refdvrescaled refapp female age income1000 i.educ polinterest forinterest left galtan, r  

* Model 5: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp if countryid == 1, r   

* Model 6: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp female age income1000 i.educ polinterest forinterest left galtan if countryid == 1, r  

* Model 7: refugee relocation experiment
reg refdvrescaled refapp if countryid == 1, r   

* Model 8: refugee relocation experiment
reg refdvrescaled refapp female age income1000 i.educ polinterest forinterest left galtan if countryid == 1, r   

* Model 9: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp if countryid == 2, r   

* Model 10: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp female age income1000 i.educ polinterest forinterest left galtan if countryid == 2, r   

* Model 11: refugee relocation experiment
reg refdvrescaled refapp if countryid == 2, r   

* Model 12: refugee relocation experiment
reg refdvrescaled refapp female age income1000 i.educ polinterest forinterest left galtan if countryid == 2, r

*** Models 13-18: see R do file

*** Pairwise comparisons of EU cue treatment conditions: see R do file

*** Tests of hypothesis 2: Main models

* Model 19: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp trusteuaid5 trusteuaid5aidapp female age income1000 i.educ polinterest forinterest left galtan trustdeaid, r   

* Model 20: refugee relocation experiment
reg refdvrescaled refapp trusteuref5 trusteuref5refapp female age income1000 i.educ polinterest forinterest left galtan trustderef, r 

* Model 21: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp trusteuaid5 trusteuaid5aidapp female age income1000 i.educ polinterest forinterest left galtan trustdeaid if countryid == 1, r 

* Model 22: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp trusteuaid5 trusteuaid5aidapp female age income1000 i.educ polinterest forinterest left galtan trustdeaid if countryid == 2, r   

* Model 23: refugee relocation experiment
reg refdvrescaled refapp trusteuref5 trusteuref5refapp female age income1000 i.educ polinterest forinterest left galtan trustderef if countryid == 1, r 

* Model 24: refugee relocation experiment
reg refdvrescaled refapp trusteuref5 trusteuref5refapp female age income1000 i.educ polinterest forinterest left galtan trustderef if countryid == 2, r  

*** Predicted probabilities plots in Figure A.2 in Online Appendix

* Note: code to calculate predicted probabilities appears below; for code to prepare plot please refer to R do file  

* Coronavirus recovery aid experiment
regress aiddvrescaled aidapp trusteuaid5 trusteuaid5aidapp female age income1000 i.educ polinterest forinterest left galtan trustdeaid, r 
margins, atmeans at(aidapp==1 trusteuaid5==0 trusteuaid5aidapp==0) // EU Council approval of policy, complete trust in EU
margins, atmeans at(aidapp==1 trusteuaid5==1 trusteuaid5aidapp==1) // EU Council approval of policy, large trust in EU
margins, atmeans at(aidapp==1 trusteuaid5==2 trusteuaid5aidapp==2) // EU Council approval of policy, moderate trust in EU
margins, atmeans at(aidapp==1 trusteuaid5==3 trusteuaid5aidapp==3) // EU Council approval of policy, little trust in EU
margins, atmeans at(aidapp==1 trusteuaid5==4 trusteuaid5aidapp==4) // EU Council approval of policy, no trust in EU at all
margins, atmeans at(aidapp==0 trusteuaid5==0 trusteuaid5aidapp==0) // no EU Council approval of policy, complete trust in EU
margins, atmeans at(aidapp==0 trusteuaid5==1 trusteuaid5aidapp==0) // no EU Council approval of policy, large trust in EU
margins, atmeans at(aidapp==0 trusteuaid5==2 trusteuaid5aidapp==0) // no EU Council approval of policy, moderate trust in EU
margins, atmeans at(aidapp==0 trusteuaid5==3 trusteuaid5aidapp==0) // no EU Council approval of policy, little trust in EU
margins, atmeans at(aidapp==0 trusteuaid5==4 trusteuaid5aidapp==0) // no EU Council approval of policy, no trust in EU at all

* Refugee relocation experiment
regress refdvrescaled refapp trusteuref5 trusteuref5refapp female age income1000 i.educ polinterest forinterest left galtan trustderef, r   
margins, atmeans at(refapp==1 trusteuref5==0 trusteuref5refapp==0) // EU Council approval of policy, complete trust in EU
margins, atmeans at(refapp==1 trusteuref5==1 trusteuref5refapp==1) // EU Council approval of policy, large trust in EU
margins, atmeans at(refapp==1 trusteuref5==2 trusteuref5refapp==2) // EU Council approval of policy, moderate trust in EU
margins, atmeans at(refapp==1 trusteuref5==3 trusteuref5refapp==3) // EU Council approval of policy, little trust in EU
margins, atmeans at(refapp==1 trusteuref5==4 trusteuref5refapp==4) // EU Council approval of policy, no trust in EU at all
margins, atmeans at(refapp==0 trusteuref5==0 trusteuref5refapp==0) // no EU Council approval of policy, complete trust in EU
margins, atmeans at(refapp==0 trusteuref5==1 trusteuref5refapp==0) // no EU Council approval of policy, large trust in EU
margins, atmeans at(refapp==0 trusteuref5==2 trusteuref5refapp==0) // no EU Council approval of policy, moderate trust in EU
margins, atmeans at(refapp==0 trusteuref5==3 trusteuref5refapp==0) // no EU Council approval of policy, little trust in EU
margins, atmeans at(refapp==0 trusteuref5==4 trusteuref5refapp==0) // no EU Council approval of policy, no trust in EU at all

*** Conditional effects plots in Figure A.3 in Online Appendix: see R do file

*** Tests of hypothesis 2: Moderation analyses in Table A.17 in Online Appendix: see R do file

*** Tests of hypothesis 3: Main models

* Model 31: Coronavirus economic recovery aid experiment
reg aiddvrescaled i.aideu female age income1000 i.educ polinterest forinterest left galtan, r

* Model 32: refugee relocation experiment
reg refdvrescaled i.refeu female age income1000 i.educ polinterest forinterest left galtan, r

* Model 33: Coronavirus economic recovery aid experiment
reg aiddvrescaled i.aideu female age income1000 i.educ polinterest forinterest left galtan if countryid == 1, r

* Model 34: Coronavirus economic recovery aid experiment
reg aiddvrescaled i.aideu female age income1000 i.educ polinterest forinterest left galtan if countryid == 2, r

* Model 35: refugee relocation experiment
reg refdvrescaled i.refeu female age income1000 i.educ polinterest forinterest left galtan if countryid == 1, r

* Model 36: refugee relocation experiment
reg refdvrescaled i.refeu female age income1000 i.educ polinterest forinterest left galtan if countryid == 2, r

*** Models with second cue about domestic elite opinion

* Model 37: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp aiddom female age income1000 i.educ polinterest forinterest left galtan if countryid == 1, r   

* Model 38: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp aiddom female age income1000 i.educ polinterest forinterest left galtan if countryid == 2, r   

* Model 39: refugee relocation experiment
reg refdvrescaled refapp refdom female age income1000 i.educ polinterest forinterest left galtan if countryid == 1, r   

* Model 40: refugee relocation experiment
reg refdvrescaled refapp refdom female age income1000 i.educ polinterest forinterest left galtan if countryid == 2, r   

*** Analyses of education, EU elite cues, and trust in EU elites

* Model 41: Coronavirus economic recovery aid experiment
reg aiddvrescaled i.educ##aidapp female age income1000 polinterest forinterest left galtan, r

* Model 42: refugee relocation experiment
reg refdvrescaled i.educ##refapp female age income1000 polinterest forinterest left galtan, r

* Model 43: Coronavirus economic recovery aid experiment
reg aiddvrescaled i.educ##aidapp female age income1000 polinterest forinterest left galtan if countryid == 1, r

* Model 44: Coronavirus economic recovery aid experiment
reg aiddvrescaled i.educ##aidapp female age income1000 polinterest forinterest left galtan if countryid == 2, r

* Model 45: refugee relocation experiment
reg refdvrescaled i.educ##refapp female age income1000 polinterest forinterest left galtan if countryid == 1, r

* Model 46: refugee relocation experiment
reg refdvrescaled i.educ##refapp female age income1000 polinterest forinterest left galtan if countryid == 2, r

* Model 47: Coronavirus economic recovery aid experiment
reg aiddvrescaled i.educ##i.aideu female age income1000 polinterest forinterest left galtan, r

* Model 48: refugee relocation experiment
reg refdvrescaled i.educ##i.refeu female age income1000 polinterest forinterest left galtan, r

* Model 49: Coronavirus economic recovery aid experiment
reg aiddvrescaled i.educ##i.aideu female age income1000 polinterest forinterest left galtan if countryid == 1, r

* Model 50: Coronavirus economic recovery aid experiment
reg aiddvrescaled i.educ##i.aideu female age income1000 polinterest forinterest left galtan if countryid == 2, r

* Model 51: refugee relocation experiment
reg refdvrescaled i.educ##i.refeu female age income1000 polinterest forinterest left galtan if countryid == 1, r

* Model 52: refugee relocation experiment
reg refdvrescaled i.educ##i.refeu female age income1000 polinterest forinterest left galtan if countryid == 2, r

* Model 53: Coronavirus economic recovery aid experiment
reg trusteuaid5 female age income1000 i.educ polinterest forinterest left galtan, r  

* Model 54: refugee relocation experiment
reg trusteuref5 female age income1000 i.educ polinterest forinterest left galtan, r  

* Model 55: Coronavirus economic recovery aid experiment
reg trusteuaid5 female age income1000 i.educ polinterest forinterest left galtan if countryid == 1, r  

* Model 56: Coronavirus economic recovery aid experiment
reg trusteuaid5 female age income1000 i.educ polinterest forinterest left galtan if countryid == 2, r  

* Model 57: refugee relocation experiment
reg trusteuref5 female age income1000 i.educ polinterest forinterest left galtan if countryid == 1, r  

* Model 58: refugee relocation experiment
reg trusteuref5 female age income1000 i.educ polinterest forinterest left galtan if countryid == 2, r  

*** Models with province (Bundesland) fixed effects

* Model 59: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp i.land, r cluster(land)  

* Model 60: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp female age income1000 i.educ polinterest forinterest left galtan i.land, r cluster(land)  

* Model 61: refugee relocation experiment
reg refdvrescaled refapp i.land, r cluster(land)  

* Model 62: refugee relocation experiment
reg refdvrescaled refapp female age income1000 i.educ polinterest forinterest left galtan i.land, r cluster(land)  

* Model 63: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp i.land if countryid == 1, r cluster(land)  

* Model 64: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp female age income1000 i.educ polinterest forinterest left galtan i.land if countryid == 1, r cluster(land)  

* Model 65: refugee relocation experiment
reg refdvrescaled refapp i.land if countryid == 1, r cluster(land)  

* Model 66: refugee relocation experiment
reg refdvrescaled refapp female age income1000 i.educ polinterest forinterest left galtan i.land if countryid == 1, r cluster(land)  

* Model 67: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp i.land if countryid == 2, r cluster(land)  

* Model 68: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp female age income1000 i.educ polinterest forinterest left galtan i.land if countryid == 2, r cluster(land)  

* Model 69: refugee relocation experiment
reg refdvrescaled refapp i.land if countryid == 2, r cluster(land)  

* Model 70: refugee relocation experiment
reg refdvrescaled refapp female age income1000 i.educ polinterest forinterest left galtan i.land if countryid == 2, r cluster(land)  

* Model 71: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp trusteuaid5 trusteuaid5aidapp female age income1000 i.educ polinterest forinterest left galtan trustdeaid i.land, r cluster(land)  

* Model 72: refugee relocation experiment
reg refdvrescaled refapp trusteuref5 trusteuref5refapp female age income1000 i.educ polinterest forinterest left galtan trustderef i.land, r cluster(land)  

* Model 73: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp trusteuaid5 trusteuaid5aidapp female age income1000 i.educ polinterest forinterest left galtan trustdeaid i.land if countryid == 1, r cluster(land)  

* Model 74: Coronavirus economic recovery aid experiment
reg aiddvrescaled aidapp trusteuaid5 trusteuaid5aidapp female age income1000 i.educ polinterest forinterest left galtan trustdeaid i.land if countryid == 2, r cluster(land)  

* Model 75: refugee relocation experiment
reg refdvrescaled refapp trusteuref5 trusteuref5refapp female age income1000 i.educ polinterest forinterest left galtan trustderef i.land if countryid == 1, r cluster(land)  

* Model 76: refugee relocation experiment
reg refdvrescaled refapp trusteuref5 trusteuref5refapp female age income1000 i.educ polinterest forinterest left galtan trustderef i.land if countryid == 2, r cluster(land)  

* Model 77: Coronavirus economic recovery aid experiment
reg aiddvrescaled i.aideu female age income1000 i.educ polinterest forinterest left galtan i.land, r cluster(land)  

* Model 78: refugee relocation experiment
reg refdvrescaled i.refeu female age income1000 i.educ polinterest forinterest left galtan i.land, r cluster(land) 

* Model 79: Coronavirus economic recovery aid experiment
reg aiddvrescaled i.aideu female age income1000 i.educ polinterest forinterest left galtan i.land if countryid == 1, r cluster(land)  

* Model 80: Coronavirus economic recovery aid experiment
reg aiddvrescaled i.aideu female age income1000 i.educ polinterest forinterest left galtan i.land if countryid == 2, r cluster(land)  

* Model 81: refugee relocation experiment
reg refdvrescaled i.refeu female age income1000 i.educ polinterest forinterest left galtan i.land if countryid == 1, r cluster(land) 

* Model 82: refugee relocation experiment
reg refdvrescaled i.refeu female age income1000 i.educ polinterest forinterest left galtan i.land if countryid == 2, r cluster(land) 

*** Quasi-experimental analysis of Eurobarometer data
*****************************************************

*** Tests of hypotheses 1 and 2: Main models

* Model 83: quasi-experimental analyses of Eurobarometer data 
reg financialsupport aftereusummit female age i.incomecat i.educ polinterest eurinterest left leftsq, r 

* Model 84: quasi-experimental analyses of Eurobarometer data 
reg financialsupport aftereusummit trusteucorona aftersummittrusteucorona female age i.incomecat i.educ polinterest eurinterest left leftsq, r 

*** Tests of hypothesis 2: Conditional effects plot in Figure A.4 in Online Appendix: see R do file

*** Tests of hypothesis 2: Moderation analyses in Table A.37 in Online Appendix: see R do file

*** Covariate balance tests

* Model 86: quasi-experimental analyses of Eurobarometer data 
reg aftereusummit female age i.incomecat i.educ polinterest eurinterest left leftsq i.ccode, r 

* Model 87: quasi-experimental analyses of Eurobarometer data 
reg aftereusummit female age i.incomecat i.educ polinterest eurinterest left leftsq i.region, r 

* Model 88: quasi-experimental analyses of Eurobarometer data 
reg trusteucorona aftereusummit female age i.incomecat i.educ polinterest eurinterest left leftsq i.ccode, r

* Model 89: quasi-experimental analyses of Eurobarometer data 
reg trusteucorona aftereusummit female age i.incomecat i.educ polinterest eurinterest left leftsq i.region, r

*** Placebo test

* Model 90: quasi-experimental analyses of Eurobarometer data 
reg freemove aftereusummit female age i.incomecat i.educ polinterest eurinterest left leftsq, r